<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description("Tests RTCSessionDescription.");

var initializer = {type:"offer", sdp:"foobar"};
var sessionDescription;
shouldNotThrow("sessionDescription = new RTCSessionDescription(initializer);");
shouldBe('sessionDescription.type', '"offer"');
shouldBe('sessionDescription.sdp', '"foobar"');

shouldNotThrow('initializer = JSON.parse(JSON.stringify(sessionDescription));');

shouldNotThrow("sessionDescription = new RTCSessionDescription(initializer);");
shouldBe('sessionDescription.type', '"offer"');
shouldBe('sessionDescription.sdp', '"foobar"');

shouldNotThrow("new RTCSessionDescription();");
shouldNotThrow("new RTCSessionDescription({});");
shouldThrow("new RTCSessionDescription(5);");
shouldThrow("new RTCSessionDescription('foobar');");
shouldThrow("new RTCSessionDescription({type:'foobar', sdp:'x'});");
shouldNotThrow("new RTCSessionDescription({type:'offer', sdp:''});");

shouldNotThrow("new RTCSessionDescription({type:'offer', sdp:'x'});");
shouldNotThrow("new RTCSessionDescription({type:'answer', sdp:'x'});");
shouldNotThrow("new RTCSessionDescription({type:'pranswer', sdp:'x'});");

window.successfullyParsed = true;
</script>
</body>
</html>
